package com.IClass.IActivity;


import java.util.Map;

import com.IClass.iHotBlogListAdapter;
import com.IClass.App.IClass;
import com.IClass.App.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

public class IHotBlogListActivity extends Activity {
	public ListView list;
	  
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.iask_hotbloglist_layout);
		iHotBlogListAdapter listItemAdapter = new iHotBlogListAdapter(this,IClass.gethotblogslist());
		list = (ListView) findViewById(R.id.iask_hotbloglist_view);  
		
		list.setAdapter(listItemAdapter); 
		
		list.setOnItemClickListener(new OnItemClickListener() {  
  
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) 
			{
				// TODO Auto-generated method stub
				iHotBlogListAdapter t = (iHotBlogListAdapter)arg0.getAdapter();
				Map<String, Object> m = (Map<String, Object>)t.getItem(arg2);
				String blogid = (String)m.get("hash_data");
				blogid = blogid.substring(blogid.indexOf("blogid") + 6);
				
				
		        
				
				
				Intent blogdisscuss = new Intent(arg0.getContext(),IBlogDiscussActivity.class);
				blogdisscuss.putExtra("blogid", blogid);
				startActivity(blogdisscuss);    //启动Main界面
                
			}  
        } );
	}
}
